package com.mls.fivedistrict.pojo;

import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.enums.IdType;

import java.math.BigDecimal;
import java.util.Date;

import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;

import java.io.Serializable;
import java.util.List;

import com.baomidou.mybatisplus.annotations.Version;

import com.mls.fivedistrict.enums.VoteStatusEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

/**
 * <p>
 * 投票
 * </p>
 *
 * @author Five Team
 * @since 2018-05-21
 */
@Data
@Accessors(chain = true)
@TableName(value = "t_vote", resultMap = "BaseResultMapAndVoteOption")
public class Vote extends Model<Vote> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 标题
     */
    @NotBlank(message = "标题不能为空")
    @Length(min = 4, max = 20, message = "标题必须在4~20个字以内")
    private String title;
    /**
     * 结束日期
     */
//    @NotBlank(message = "结束日期不能为空")
    private Date endDate;
    /**
     * 参与人数，人数够自动截止
     */
//    @NotBlank(message = "参与人数不能为空")
    private Integer peoploTotal;
    /**
     * 描述
     */
    private String description;
    /**
     * 选项模式：0：单选 1：多选最多2项 2：不限次数
     */
//    @NotBlank(message = "选项模式必须要选")
    private String choiceType;
    /**
     * 每个人可参加的次数
     */
//    @NotBlank(message = "每个人参加的次数不能为空")
    private Integer canJoinCount;
    private Date updateDate;
    private Date createDate;
    /**
     * 选项结果的ID
     */
    private Long optionResultId;
    private String createBy;

    @TableLogic
    private Boolean isDelete;
    private Boolean isEnable;
    /**
     * 投票主体表
     */

    private Integer orders;
    /**
     * 参与人的最小DWQ数量
     */
    private BigDecimal minDwqAbility;
    private Integer joinCount;
    private Integer voteCount;
    private Long version;

    /**
     * 投票状态
     */
    private VoteStatusEnum status;
    private String mainIcon;

    /**
     * 奖励DWQ数量
     */
    private BigDecimal rewardDwqNumber;


    private transient List<VoteOption> voteOptionList;


    public Boolean getDelete() {
        return isDelete;
    }

    public void setDelete(Boolean delete) {
        isDelete = delete;
    }

    public Boolean getEnable() {
        return isEnable;
    }

    public void setEnable(Boolean enable) {
        isEnable = enable;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }


}
